<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreatePositionUnitsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('position_units', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('position_id',false)->default(0)->index()->comment('点位id');
            $table->unsignedBigInteger('unit_id',false)->default(0)->index()->comment('单位id');
            $table->unsignedTinyInteger('type',false)->default(1)->comment('类型 1=责任单位 2=协作单位');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('position_units');
    }
}
